<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpages/Default.master" AutoEventWireup="true" CodeBehind="ManageProducts.aspx.cs" Inherits="Blazing.UI.Cms.Admin.Extension.eCommerce.ManageProducts" %>
<%@ Register TagPrefix="blazing" Namespace="Blazing.UI.Cms.Admin.Classes" Assembly="Blazing.UI.Cms.Admin" %>

<%@ Register src="~/Usercontrols/ObjectTagCloud.ascx" tagname="ObjectTagCloud" tagprefix="uc2" %>
<%@ Register src="~/Usercontrols/Loading.ascx" tagname="Loading" tagprefix="uc3" %>


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Manage Products</h1>
    <br />
    <ajax:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div class="grid">  
    <asp:GridView ID="GridViewProducts" runat="server" CaptionAlign="Left" EmptyDataText="No products have been entered yet." 
            CssClass="gridview" CellPadding="4" AutoGenerateColumns="False" 
            DataSourceID="ObjectDataSourceProducts" DataKeyNames="ID,RowStamp,RowState" >
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                SortExpression="ID" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="ProductCode" HeaderText="ProductCode" SortExpression="ProductCode" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:BoundField DataField="PriceNett" HeaderText="PriceNett" 
                SortExpression="PriceNett" ControlStyle-Width="50" />
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" ControlStyle-Width="50" />
            <asp:BoundField DataField="InStock" HeaderText="In Stock" 
                SortExpression="InStock" />
            <asp:BoundField DataField="StockDate" HeaderText="StockDate" DataFormatString="{0: dd/MM/yyyy}"
                SortExpression="StockDate" />
            <asp:CheckBoxField DataField="HasInventory" HeaderText="Has Inventory" 
                SortExpression="HasInventory" />
            <asp:CheckBoxField DataField="Active" HeaderText="Active" 
                SortExpression="Active" />
            <asp:TemplateField HeaderText="TaxonomyTags" SortExpression="TaxonomyTags">
                <EditItemTemplate>
                    <uc2:ObjectTagCloud ID="ObjectTagCloud1" runat="server" TaxonomyTags='<%# Bind("TaxonomyTags") %>' AllowAdding="false" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Repeater ID="repeaterTags" runat="server" DataSource='<%# Eval("TaxonomyTags") %>'>
                        <ItemTemplate>
                            <span class="TagCloudItem"><strong><asp:Literal ID="Literal2" runat="server" Text='<%# Eval("Taxonomy.Name") %>'/>:</strong><asp:Literal ID="Literal3" runat="server" Text='<%# Eval("Tag.Name") %>' /></span>
                        </ItemTemplate>
                    </asp:Repeater>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" />
        </Columns>
    </asp:GridView>
    </div>
    </ContentTemplate>
    </ajax:UpdatePanel>
    <asp:ObjectDataSource ID="ObjectDataSourceProducts" runat="server" 
        DataObjectTypeName="Blazing.BusinessObjects.Products.Product" 
        DeleteMethod="DeleteProduct" InsertMethod="NewProduct" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetProducts" 
        TypeName="Blazing.WebFacade.ProductsController" UpdateMethod="UpdateProduct">
    </asp:ObjectDataSource>
    <br />
    <asp:LinkButton ID="LinkButtonInsertProduct" runat="server">Insert</asp:LinkButton><br />
        <asp:Panel ID="PanelAddProduct" runat="server">
            <blazing:RoundedPanel ID="rp1" runat="server" width="400px"> 
                <div class="grid">
                    <div class="gridview">
                    <asp:Panel ID="PanelAddProductTitle" CssClass="gridheader" runat="server">
                            Add Product</asp:Panel>
                        <asp:DetailsView ID="DetailsViewInsertProduct" runat="server" AutoGenerateRows="False" 
                             BorderWidth="0px" Width="100%" DefaultMode="Insert" DataSourceID="ObjectDataSourceProducts" 
                             >

                            <RowStyle CssClass="row" />
                            <EditRowStyle CssClass="edit-info" />               
                            <PagerStyle BackColor="White" ForeColor="White" HorizontalAlign="Center" />
                            <Fields>
                                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                                    ReadOnly="True" SortExpression="ID" />
                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                <asp:BoundField DataField="Description" HeaderText="Description" 
                                    SortExpression="Description" />
                                <asp:BoundField DataField="PriceNett" HeaderText="PriceNett" 
                                    SortExpression="PriceNett" />
                                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                                <asp:BoundField DataField="InStock" HeaderText="InStock" 
                                    SortExpression="InStock" />
                                <asp:BoundField DataField="StockDate" HeaderText="StockDate" 
                                    SortExpression="StockDate" />
                                <asp:CheckBoxField DataField="HasInventory" HeaderText="HasInventory" 
                                    SortExpression="HasInventory" />
                                <asp:CheckBoxField DataField="Active" HeaderText="Active" 
                                    SortExpression="Active" />
                                <asp:CommandField ShowInsertButton="True" />
                            </Fields>
                            <HeaderStyle CssClass="gridheader" />
                            <AlternatingRowStyle CssClass="row alt" />
                        </asp:DetailsView>
                    </div>
                </div>           
           </blazing:RoundedPanel>
        </asp:Panel>
           
    <ajax:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="LinkButtonInsertProduct"
        PopupControlID="PanelAddProduct" PopupDragHandleControlID="PanelAddProductTitle" 
            SkinID="Popup1" DynamicServicePath="" Enabled="True">
    </ajax:ModalPopupExtender> 

    <ajax:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
    <uc3:Loading ID="Loading1" runat="server" /></ProgressTemplate>
    </ajax:UpdateProgress>

</asp:Content>
